package com.peanut.service.Impl;

import com.peanut.dao.*;
import com.peanut.model.AboutUsModel;
import com.peanut.model.CommonModel;
import com.peanut.model.HomeModel;
import com.peanut.service.AboutUsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class AboutUsServiceImpl implements AboutUsService {
    @Autowired
    private HomeDao homeDao;
    @Autowired
    private CommonDao commonDao;
    @Autowired
    private CaseDao caseDao;
    @Autowired
    private AboutUsDao aboutUsDao;
    @Autowired
    private PlanDao planDao;
    @Autowired
    private NavDao navDao;

    @Override
    public Map<String,Object> getAboutUs() {

        Map<String, Object> map = new HashMap<String, Object>();
        //公共的数据
        List<CommonModel> list = new ArrayList<>();
        list.add(commonDao.getCommonDate());
        map.put("common", list);
        //导航
        map.put("nav", navDao.getNavList());
        map.put("mNav",navDao.getMNavList());
        //案例
        map.put("case", caseDao.getAboutCaseList());
        //首页数据
        List<HomeModel> homeList = new ArrayList<>();
        homeList.add(homeDao.getHomeModel());
        map.put("homeModel", homeList);
        //新闻
        List<AboutUsModel> aList = new ArrayList<>();
        aList.add(aboutUsDao.getAboutUs());
        map.put("aboutUsModel", aList);
        //我们能做什么的数据
        map.put("planList", planDao.getPlanList());
        return map;
    }
}
